package cn.dengta.webapp.user.entity;

import java.util.Date;

import cn.dengta.webapp.base.entity.BizEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import me.codeplayer.util.StringUtil;

/**
 * 邮件发送记录
 *
 * @author lgy
 * @since 2022-03-22
 */
@Setter
@Getter
@Accessors(chain = true)
public class EmailLog extends BizEntity {

	/** 关联用户ID */
	private Long userId;
	/** 邮件地址 */
	private String email;
	/** 邮件地址 */
	private String bizType;
	/** 内容 */
	private String content;
	/** 客户端IP */
	private String clientIp;
	/** 响应内容 */
	private String response;

	public void setId(Long id) {
		this.id = id;
	}

	public EmailLog init(Long userId, String email, String content, String clientIp, String bizType, String response, Date now) {
		this.userId = userId;
		this.email = StringUtil.toString(email);
		this.content = StringUtil.toString(content);
		this.clientIp = clientIp;
		this.bizType = bizType;
		this.response = StringUtil.toString(response);
		super.initTime(now);
		return this;
	}

}
